//
//  CALayer+XibAddition.m
//  DuoBao
//
//  Created by TobyYoung on 2017/5/10.
//  Copyright © 2017年 Answern. All rights reserved.
//

#import "CALayer+XibAddition.h"

@implementation CALayer (XibAddition)

- (void)setBorderUIColor:(UIColor*)color {
    
    self.borderColor = color.CGColor;
}

- (UIColor*)borderUIColor {
    
    return [UIColor colorWithCGColor:self.borderColor];
}

// 心跳
- (void)heartbeat {
    
    
    [UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut animations:^{
        
        [self setValue:@(1.5) forKeyPath:@"transform.scale"];
        
    } completion:^(BOOL finished) {
        
        [UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut animations:^{
            
            [self setValue:@(0.9) forKeyPath:@"transform.scale"];
            
        } completion:^(BOOL finished) {
            [UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut animations:^{
                
                [self setValue:@(1.0) forKeyPath:@"transform.scale"];
                
            } completion:^(BOOL finished) {
                
            }];
        }];
    }];
}
@end
